﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls; 
using System.IO;
using Adex;
using MediaMonitor.Common;

namespace MediaMonitor.SiteFiles
{
    public partial class Download : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

            if (!IsPostBack)
            {

                string type = Utility.GetRequestedVal("type", "");
                int odid = Utility.ToInt(Utility.GetRequestedVal("odid", "0"));

                if (odid > 0)
                {
                    OrderDetail od = new OrderDetail(odid);

                    switch (type.ToLower())
                    {
                        case "tv":
                            Utility.DownloadFile("../videos/" + od.FullVideoFile, true);
                            break;

                        case "radio":
                        case "cable":
                            Utility.DownloadFile("../radio/" + od.RadioFile, true);
                            break;

                        case "press":
                            Utility.DownloadFile("../press/" + od.PressFile, true);
                            break;

                        case "outdoor":
                            Utility.DownloadFile("../outdoor/" + od.OutDoorFile, true);
                            break;

                        case "internet":
                            Utility.DownloadFile("../internet/" + od.InternetFile, true);
                            break;

                    }

                }
            }
        }
    }
}